package com.shell.arouter.demo.motion

import android.content.Intent
import android.os.Build
import android.transition.Explode
import android.transition.Fade
import android.transition.Slide
import com.alibaba.android.arouter.facade.annotation.Route
import com.henanjianye.soon.communityo2o2.R
import com.shell.arouter.ui.activity.ActivityCommon

/**
 * 说明：ActivitySampleTranslate
 * <p/>
 * 作者：fanly
 * <p/>
 * 类型：Class
 * <p/>
 * 时间：2020-02-25 16:16
 * <p/>
 * 版本：version 1.0
 */
@Route(path = "/motion/sampletranslate")
open class ActivitySampleTranslate : ActivityCommon(){

    var key = 1

    override fun getIntentData(intent: Intent?) {
        super.getIntentData(intent)
        key = intent?.getIntExtra("key",1) ?: 1
    }

    override fun setViewBefor() {
        super.setViewBefor()
        window.run {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                when(key){
                    1->{
                        enterTransition = Explode().setDuration(300)
                        exitTransition = Explode().setDuration(300)
                    }
                    2->{
                        enterTransition = Fade().setDuration(300)
                        exitTransition = Fade().setDuration(300)
                    }
                    3->{
                        enterTransition = Slide().setDuration(300)
                        exitTransition = Slide().setDuration(300)
                    }
                }
            }
        }
    }

    override fun isShowTitleBar(): Boolean {
        return true
    }

    override fun onInitStart() {
    }

    override fun isShowTitleBarBack(): Boolean {
        return true
    }

    override fun bindTitleBarText(): String {
        return "Translate"
    }
    override fun getRootViewResID(): Int {
        return R.layout.activity_sample_translate
    }

}